{extend name="../../admin/view/main"}

{block name="button"}
{if isset($type) and $type eq 'index'}
<!--{if auth("remove")}-->
<button class='layui-btn layui-btn-sm layui-btn-primary'
        data-action='{:url("remove")}' data-rule="id#{key};deleted#1">删 除</button>
<!--{/if}-->
{else}
<!--{if auth("remove")}-->
<button class='layui-btn layui-btn-sm layui-btn-primary' data-action='{:url("remove")}'
        data-confirm="确定要恢复这些数据吗？" data-rule="id#{key};deleted#0">恢 复
</button>
<!--{/if}-->
{/if}
{/block}

{block name="content"}
<div class="layui-tab layui-tab-card">
    <ul class="layui-tab-title">
        {foreach ['index'=>'全部数据','youxiao'=>'有效用户','guoqi'=>'过期用户','santian'=>'近三天登录'] as $k=>$v}
        {if isset($type) and $type eq $k}
        <li class="layui-this" data-open="{:url('index')}?type={$k}">{$v}</li>
        {else}
        <li data-open="{:url('index')}?type={$k}">{$v}</li>
        {/if}{/foreach}
    </ul>
    <div class="layui-tab-content">
        {include file='user_list_controller/index_search'}
        <table class="layui-table margin-top-10" lay-skin="line">
            {notempty name='list'}
            <thead>
            <tr>
                <th>用户ID</th>
                <th>账号信息</th>
                <th>套餐信息</th>
                <th>登录信息</th>
                <th>登录应用</th>
                <th>创建人/时间</th>
                <th>操作</th>
            </tr>
            </thead>
            {/notempty}
            <tbody>
            {foreach $list as $key=>$vo}
            <tr>
                <td class="nowrap">{$vo.id}</td>
                <td class="nowrap">
                    <div>昵称：{$vo.user_nickname|default='--'}</div>
                    <div>账号：{$vo.user_name|default='--'}</div>
                    <div>行业：{foreach $industrys as $s}{eq name='vo.industry_id' value='$s.industry_id'}{$s.industry_name}{/eq}{/foreach}</div>
                    <div>代理人：{foreach $proxys as $s}{eq name='vo.pid' value='$s.id'} <span class="color-blue">[{$s.user_nickname}]{$s.user_account}</span> {/eq}{/foreach}</div>
                    <div>用户状态：
                        {eq name='vo.user_state' value='0'}<span class="layui-badge layui-bg-blue">正常</span>{/eq}
                        {eq name='vo.user_state' value='1'}<span class="layui-badge layui-bg-cyan">禁止登录</span>{/eq}</div>
                </td>
                <td class="nowrap">
                    <div>套餐名称：{eq name='$vo.thali_type' value='1'}
                        {foreach $thalis as $s}
                        {eq name='vo.thali_id' value='$s.thali_id'}
                        <span class="layui-badge layui-bg-blue">{$s.thali_name|default='--'}</span>
                        {/eq}
                        {/foreach}
                        {else}未购买套餐{/eq}</div>
                    <div>问答订购：{eq name='vo.qa_status' value='1'}<span class="color-blue">已订购</span>{else}未订购{/eq} 结束至{$vo.qa_endtime|default="--"}</div>
                    <div>训练订购：{eq name='vo.train_status' value='1'}<span class="color-blue">已订购</span>{else}未订购{/eq} 结束至{$vo.train_endtime|default="--"}</div>
                    <div>套餐开始：{$vo.thali_starttime|default='--'}</div>
                    <div>套餐结束：{$vo.thali_endtime|default='--'}</div>
                </td>
                <td class="nowrap">
                    <div>登录次数：{$vo.login_num|default='--'}</div>
                    <div>登录时间：{$vo.login_time|default='--'}</div>
                    <div>最近使用：{foreach $lastLoginTimes as $last}{eq name='vo.id' value='$last.user_id'}{$last.latest_login_time}{/eq}{/foreach}</div>
                    <div>登录IP：{$vo.login_ip|default='--'}</div>
                    <div>登录地区：{$vo.login_address|default='--'}</div>
                </td>
                <td class="nowrap">
                    <div>真实绑定应用：{foreach $apps as $s}{eq name='vo.app_id' value='$s.app_id'}{$s.app_name}{/eq}{/foreach}</div>
                    <div>登录APP名称：{$vo.login_appName|default='--'}</div>
                    <div>登录APP包名：{$vo.login_packageName|default='--'}</div>
                    <div>登录APP版本号：{$vo.login_versionName|default='--'}</div>
                    <div>登录APP迭代号：{$vo.login_versionCode|default='--'}</div>
                </td>
                <td class="nowrap">
                    <div>创建人：{foreach $proxys as $s}{eq name='vo.create_userid' value='$s.id'}{$s.user_nickname}{/eq}{/foreach}</div>
                    <div>创建时间：{$vo.create_time|default='--'}</div>
                </td>
                <td class='nowrap sub-strong-blue'>
                    <!--{if auth("edit")}-->
                    <a class="layui-btn layui-btn-xs" data-modal='{:url("edit")}?id={$vo.id}'>编 辑</a>
                    <!--{/if}-->
                    <!--{if auth("userstate")}-->
                    {if $vo.user_state eq '1'}
                    <a class="layui-btn layui-btn-xs" data-action="{:url('userstate')}" data-value="id#{$vo.id};user_state#0">允许登录</a>
                    {else}
                    <a class="layui-btn layui-btn-xs layui-btn-danger" data-action="{:url('userstate')}" data-value="id#{$vo.id};user_state#1">禁止登录</a>
                    {/if}
                    <!--{/if}-->
                </td>
            </tr>
            {/foreach}
            </tbody>
        </table>
        {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
    </div>
</div>

{/block}
